package com.asset.dispoal.formula;

import com.asset.dispoal.formula.api.IGbFormulaService;
import com.asset.dispoal.formula.dto.GbFormulaRequest;
import com.asset.dispoal.formula.dto.GbFormulaResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.mhuang.pacebox.springboot.core.controller.BaseController;
import tech.mhuang.pacebox.springboot.protocol.Result;
import tech.mhuang.pacebox.springboot.protocol.data.PageVO;


/**
 * 控制层
 *
 * @author: mhuang
 * @date: 2022-02-17 13:09:09
 */
@RestController
@RequestMapping("gbFormula")
@Api(value = "公式管理", tags = "公式管理")
public class GbFormulaController extends BaseController {

    @Autowired
    private IGbFormulaService gbFormulaService;


    @GetMapping(value = "/page")
    @ApiOperation(value = "分页查询", notes = "分页查询")
    public Result<PageVO<GbFormulaResponse>> page(GbFormulaRequest gbFormula) {
        return gbFormulaService.page(gbFormula);
    }

    @PostMapping(value = "/insert")
    @ApiOperation(value = "添加", notes = "添加")
    public Result insert(@RequestBody GbFormulaRequest gbFormula) {
        return gbFormulaService.insert(gbFormula);
    }

    @PutMapping(value = "/update")
    @ApiOperation(value = "修改", notes = "修改")
    public Result update(@RequestBody GbFormulaRequest gbFormula) {
        return gbFormulaService.update(gbFormula);
    }

    @PostMapping(value = "/delete")
    @ApiOperation(value = "删除", notes = "删除")
    public Result delete(@RequestBody String id) {
        return gbFormulaService.delete(id);
    }
}